package autoteam.ui.dialogs;

import java.awt.Dimension;

import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JOptionPane;

import controller.RSMSController;

public abstract class AutoTeamDialog extends JDialog
{
	private static final long serialVersionUID = -1910502353167480446L;

	private Dimension defaultSize = new Dimension(300, 450);
	protected JOptionPane optionPane;

	// private final JFrame dialogOwner;

	public AutoTeamDialog()
	{
		super();
		setDefaultSize();
		this.setResizable(false);
		RSMSController.resizeDialog(this);
	}

	public AutoTeamDialog(JFrame owner)
	{
		super(owner, true);
		setDefaultSize();
		this.setResizable(false);
		RSMSController.resizeDialog(this);
	}

	public AutoTeamDialog(JFrame owner, Dimension dialogSize)
	{
		super(owner, true);
		this.setPreferredSize(defaultSize);
		this.setMinimumSize(dialogSize);
		this.setSize(dialogSize);
		this.setResizable(false);
		RSMSController.resizeDialog(this);

	}

	public void setDialogSize(Dimension size)
	{
		defaultSize = size;
		setDefaultSize();
		RSMSController.resizeDialog(this);
	}

	private void setDefaultSize()
	{
		this.setPreferredSize(defaultSize);
		this.setMaximumSize(defaultSize);
		this.setMinimumSize(defaultSize);
		this.setSize(defaultSize);
	}

	public void close()
	{
		super.setVisible(false);
		super.dispose();
	}

	protected abstract void setButtonActions(final AutoTeamDialog thisDialog);
}